// TODO: 这道题没读懂，再读一遍。

/**
 * @file luogu/6171/main.cpp
 * @name Fenced In
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @brief
 * @version 0.1
 * @date 2022-05-01
 * @see <https://www.luogu.com.cn/record/74966952>
 *
 * @copyright Copyright (c) 2022
 *
 */

#include <bits/stdc++.h>
using namespace std;
const int N = 2004;
int pa[N * N];
int find(int x) { return x == pa[x] ? x : pa[x] = find(pa[x]); }
bool merge(int x, int y) {
  x = find(x), y = find(y), pa[x] = y;
  return x != y;
}
int a, b, m, n;
int enc(int r, int c) { return r * m + c; }
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> a >> b >> n >> m;
  vector<int> w(n + 1), h(m + 1);
  for (int i = 0; i < n; ++i) cin >> w[i];
  sort(w.begin(), w.end());
  for (int i = 0; i < n; ++i) w[i] = w[i + 1] - w[i];
  w[n] = b - w[n];

  for (int i = 0; i < m; ++i) cin >> h[i];
  sort(h.begin(), h.end());
  for (int i = 0; i < m; ++i) h[i] = h[i + 1] - h[i];
  h[m] = a - h[m];

  sort(w.begin(), w.end()), sort(h.begin(), h.end()), n++, m++;
  for (int i = 0; i < n * m; ++i) pa[i] = i;
  long long ans = 0;
  for (int vi = 0, hi = 0; vi < n || hi < m;) {
    if (hi == m || vi < n && w[vi] < h[hi]) {
      for (int i = 0; i < m - 1; ++i) {
        if (merge(enc(vi, i), enc(vi, i + 1))) ans += w[vi];
      }
      vi++;
    } else {
      for (int i = 0; i < n - 1; ++i) {
        if (merge(enc(i, hi), enc(i + 1, hi))) ans += h[hi];
      }
      hi++;
    }
  }
  cout << ans << endl;
}
